<%@ page language="java" contentType="text/html; charset=UTF-8}"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
   		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="juanjuan" content="2015?11?27???12:43:15">
		<meta name="keywords" content="the keywords">
		<meta name="description" content="">
		<link rel="icon" href="images/favicon.ico">
		<link href="css/bootstrap.css" rel="stylesheet">
		<title></title>
	</head>
	<body>
		<div class="container-fluid">
			<hr>
  			<form action="${pageContext.servletContext.contextPath }/form" method="post">
  				姓名：<input type="text" name="name">
  				<input type="submit" value="form提交"><br>
  			</form>
  			<hr>
  			姓名：<input type="text" name="name" id="name">
  				<input type="button" value="ajax提交" onclick="myclick()"><br>
  				
			<hr>
			<form action="${pageContext.servletContext.contextPath }/file" method="post" enctype="multipart/form-data">
  				<input type="file" name="file">
  				<input type="submit" value="file提交"><br>
  			</form>  		
		</div>
		
		<!-- js -->
		<script src="js/jquery-1.11.1.js"></script>
    	<script src="js/bootstrap.js"></script>
    	<script>
    		function myclick(){
    			var name=$("#name").val();
    			console.log(name);
    			var jsObj={"name":name};
    			var json=JSON.stringify(jsObj);
    			console.log(json);
    			$.ajax({
    				url:"${pageContext.servletContext.contextPath }/ajax",
    				contentType:"application/json",
    				type:"post",
    				data:json,
    				success:function(data){
    					console.log(data);
    				}
    			});
    		}
    	</script>
	</body>
</html>